<?php

namespace App\Http\Controllers;

use App\Models\Question;
use Illuminate\Http\Request;

class QuestionController extends Controller
{
    //
    public function index()
    {
//        return view('questions.index', compact(Question::query()->get()));
    }

    public function show($questionId)
    {
        $question = Question::query()->published()->findOrFail($questionId);
        $answers = $question->answers()->paginate(10);
        return view('questions.show',compact('question','answers'));
    }
}
